package com.example.j280_webproject.day040;

import java.util.ArrayList;
import java.util.Iterator;

public class Test01 {
    public static void main(String[] args) {
        ArrayList<Integer> integerArrayList = new ArrayList<>();
        for (int i = 0; i < 100000000; i++) {
            integerArrayList.add(i);
        }
//        long startTime01 = System.currentTimeMillis();
//        for (int i = 0; i < integerArrayList.size(); i++) {
//            integerArrayList.get(i);
//        }
//        System.out.println("list="+(System.currentTimeMillis()-startTime01));

        Iterator<Integer> iterator = integerArrayList.iterator();
        long startTime02 = System.currentTimeMillis();
        while (iterator.hasNext()){
            iterator.next();
        }
        System.out.println("iterator="+(System.currentTimeMillis()-startTime02));
    }
}
